package com.ly.project_jt.controller;

import com.ly.project_jt.mapper.CategoryMapper;
import com.ly.project_jt.pojo.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CategoryController {
    //从容器中获取代理对象
    @Autowired
    CategoryMapper categoryMapper;
    //开启关闭服务器
    //localhost:1314/category/selectAll
    @RequestMapping("/category/selectAll")
    @CrossOrigin
    public List<Category> selectAll(){
        //不生成where生成的是select*from category
        List<Category> categoryList=categoryMapper.selectByExample(null);
        return categoryList;
    }
}
